// 生产环境
const path = require('path')

const webpack = require('webpack')

const common = require('./webpack.common.js')
const { merge } = require('webpack-merge')

// copy public目录
const CopyWebpackPlugin = require('copy-webpack-plugin')

module.exports = merge(common, {
    mode: 'production',
    // devtool: 'none',

    plugins: [
        new webpack.DefinePlugin({
            APP_ENV: 'prod',
            BASE_URL: '"./"',
        }),
        new CopyWebpackPlugin({
            patterns: [
                {
                    from: './public',
                    to: './',
                    // 忽略index.html模板
                    globOptions: {
                      ignore: ['**/index.html']
                    }
                },
            ],
        }),
    ],
})
